disable right click

112

how to disable right click in javascript -

// for disabling right click use this as it is 
document.addEventListener('contextmenu', event => event.preventDefault());
event.preventDefault()

Disable right click on your webpage -

<body oncontextmenu="return false">    <div></div></body>

how to disable right click on website -

document.addEventListener('contextmenu', event => event.preventDefault());

// ⇓ Test it (fiddle) ⇓

Comments

Submit
0 Comments